#include <iostream>
#include <fstream>
#include "bin_io.hpp"

using namespace std;
using namespace NIPSCompetition;

int main(int argc, char **argv) {

    if (argc != 4) {
        std::cout << argv[0] << " extract_filename extract_length save_filename" << std::endl;
        exit(-1);
    }
    printf("extract_filename %s, extract_length %s, save_filename %s\n", argv[1], argv[2], argv[3]);

    char *read_filename = argv[1];
    int extract_len = atoi(argv[2]);
    char *save_filename = argv[3];
    unsigned int n_data, dim;
    float *data = loadBin<float>(read_filename, n_data, dim, extract_len);
    printf("n_data %d, dim %d\n", n_data, dim);
    saveBin<float>(save_filename, data, n_data, dim);
    printf("save success\n");
    return 0;
}